A badge
is an overlay or replacement for an icon. You can use a badge to signify that a folder contains special files, for example. Badges are described by a 'badg'
resource you store in a file's resource fork or a folder's invisible icon file.
Figure 1-1
shows a folder alias icon displayed in standard form and with a badge.
Figure 1-1
Folder icons displayed in standard form and with a badge
There are two steps required to use a custom badge with a file object.
Clear the kExtendedFlagsAreInvalid
bit and set the kExtendedFlagHasCustomBadge
bit in the extendedFinderFlags
field of the ExtendedFileInfo
structure (if the object is a file) or the ExtendedFolderInfo
structure (if the object is a folder).
Add a resource of type kCustomBadgeResourceType
('badg'
) and ID kCustomBadgeResourceID
to a file's resource fork or a folder's icon file.
There are three ways to use the data from a 'badg'
resource.
The customBadgeType
and customBadgeCreator
fields let you designate a custom badge to display on top of another icon, as shown in
Figure 1-1
.
The windowBadgeType
and windowBadgeCreator
fields let you designate which icon to display in Finder window header of the badged file or folder.
The overrideType
and overrideCreator
fields let you designate the badge as a replacement for the standard icon for this file or folder.